var home = {
	init : function(){

		// 업체정보 클릭시
		$("#companyInfo").live("click", function(e) {
			var $target = $(e.target);
			jQuery("#pushConfirmMessage").html("업체 정보");
			$('#companyInfoLayer').modal('show');
			var companyName = $target.attr("companyName");
			var email = $target.attr("email");
			var tel = $target.attr("tel1") +"-" + $target.attr("tel2") + "-" + $target.attr("tel3");
			$("#companyName").text(companyName);
			$("#email").text(email);
			$("#tel").text(tel);
		});
		
		// modify
		$("#modify").live("click", function(e) {
			var $target = $(e.target);
			
			id = $target.attr("licenseId");
			
			modify(id);
			
		});
		
		// delete
		$("#delete").live("click", function(e) {
			var $target = $(e.target);
			var id = $target.attr("licenseId");
			var companyName = $target.attr("companyName");
			$("#id").val(id);
			$("#deleteCompanyName").text(companyName);
			$('#companyDeleteLayer').modal('show');
		});
		
		// delete yes
		$("#deleteYes").live("click", function(e) {
			deleteLicense($("#id").val());
		});
	},
};

var modify = function(id){
	window.location.href = "/smartpush_license/license/updateForm?id="+id;
};
var deleteLicense = function(id){
	window.location.href = "/smartpush_license/license/delete?id="+id;
};

var getData = function(params, url) {
	
	$.ajax({
		  type: "POST",
		  url: url,
		  dataType: "json",
		  data: params,
		  success: function(data){
			  if(data.resultCode == "200") {
				  
			  } else {
				  
			  }
		  },
		  error: function() {
			  
		  },
		  complete: function() {
			  
		  }
	});
};

$(function() {
	home.init();
});